/**
 * @see [微信官方文档](https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxwriteblecharacteristicvalueobject)
 * @param deviceId [string] 蓝牙设备 id，参考 device 对象
 * @param serviceId [string] 蓝牙特征值对应服务的 uuid
 * @param characteristicId [string] 蓝牙特征值的 uuid
 * @param value [ArrayBuffer] 蓝牙设备特征值对应的二进制值
 */

export default function write_ble_characteristic_value(deviceId: string, serviceId: string, characteristicId: string, value: ArrayBuffer) {
	return new Promise<boolean>((resolve, reject) => {
		wx.writeBLECharacteristicValue({
			characteristicId,
			deviceId,
			serviceId,
			value,
			success() {
				resolve(true);
			},
			fail() {
				reject(false);
			}
		});
	});
}
